package com.znyj.servlet.service;

import com.znyj.servlet.dao.ScheduledDao;
import com.znyj.servlet.entity.ScheduledEntity;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.List;

/**
 * Created by gaoliwei02 on 2017/11/1.
 */
@Service
public class ScheduledService {
    private static final Logger logger = Logger.getLogger(ScheduledService.class);

    @Autowired
    private ScheduledDao scheduledDao;

    public int insertScheduled(ScheduledEntity scheduledEntity) {
        return scheduledDao.insert(scheduledEntity);
    }

    public int updateScheduled(ScheduledEntity scheduledEntity) {
        return scheduledDao.update(scheduledEntity);
    }

    public ScheduledEntity findByDeviceId(String deviceId) {
        return scheduledDao.findByDeviceId(deviceId);
    }

    public ScheduledEntity findByOpenOrderId(long openOrderId) {
        return scheduledDao.findByOpenOrderId(openOrderId);
    }

    public int updateExecuteResult(String executeResult, long openOrderId) {
        return scheduledDao.updateExecuteResult(executeResult, openOrderId);
    }

    public int updateOpenOrderId(long extraDelay, long openOrderId) {
        return scheduledDao.updateOpenOrderId(extraDelay, openOrderId);
    }

    public List<ScheduledEntity> initScheduled() {
        return scheduledDao.initScheduled();
    }

}
